package cn.weforward.task.weforward.view;

import java.util.Date;

import cn.weforward.protocol.doc.annotation.DocAttribute;
import cn.weforward.task.Task;
/**
 * 只拿到子任务的id、标题、优先级、状态、负责人、预计结束时间
 * @author 朱海斌
 */
public class SimpleTaskView {
	protected Task m_Task;
	
	public SimpleTaskView(Task task) {
		m_Task = task;
	}
	
	public static SimpleTaskView valueOf(Task task) {
		return null == task?null:new SimpleTaskView(task);
	}
	
	@DocAttribute(description = "任务id")
	public String getId() {
		return m_Task.getId().getOrdinal();
	}
	
	@DocAttribute(description = "任务标题")
	public String getTitle() {
		return m_Task.getTitle();
	}
	
	@DocAttribute(description = "任务优先级")
	public String getPriority() {
		return m_Task.getPriority().getName();
	}
	
	@DocAttribute(description = "任务状态")
	public String getState() {
		return m_Task.getState().getName();
	}
	
	@DocAttribute(description = "任务负责人")
	public String getManager() {
		return m_Task.getManager();
	}
	
	@DocAttribute(description = "任务预计结束时间")
	public Date getExpectedEndTime() {
		return m_Task.getExpectedEndTime();
	}
	
	@DocAttribute(description = "任务完成时间")
	public Date getEndTime() {
		if(null != m_Task.getEndTime()) {
			return m_Task.getEndTime();
		}
		return null;
		
	}
}
